package com.exit66.jukebox.servlet.xml;

import javax.servlet.http.HttpServletRequest;

import com.exit66.jukebox.data.TrackCollection;
import com.exit66.jukebox.util.XmlSegment;

public class RequestQueueServlet extends XmlResponseServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4112273911542440279L;

	protected void buildXml(HttpServletRequest req, XmlSegment xml) {
        TrackCollection list = new TrackCollection();
        try {
            list.listByQueue();
            while (!list.isEOF()) {
                xml.appendSegment(list.getCurrent().returnXml(true));
                list.moveNext();
            }
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
	}

}
